package com.example.leo.mycharmingstudent.a0916;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import com.example.leo.mycharmingstudent.R;

import java.util.ArrayList;
import java.util.List;

public class ListViewCardViewActivity extends AppCompatActivity {

    private List<HeroEntity> mHeroList = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_view_card_view);
        ListView lvHero = findViewById(R.id.lv_activity_list_view);

        for (int i = 0; i < 5; i++) {
            mHeroList.add(new HeroEntity(R.mipmap.hero2,"二爷","大招很厉害"));
        }

        lvHero.setAdapter(new MyHeroAdapter(this, mHeroList));
    }

    /*
    ListView使用流程
    1.创建条目布局             ok
    2.创建适配器BaseAdapter，这回不用内部类的方式   ok
    3.ListView和BaseAdapter产生联系，setAdapter
     */
}
